package com.penjin.android.view.penjin;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.penjin.android.R;
import com.penjin.android.utils.BitmapUtils;
import com.penjin.android.view.CircleImageView;
import com.penjin.android.view.PenjinAvatar;

/**
 * Created by Administrator on 2016/4/23.
 * 荣誉榜 GridView item
 */
public class RongyuRankItem extends RelativeLayout {


    CircleImageView image;
    TextView score;
    PenjinAvatar rank;
    TextView name;

    Context mContext;

    public RongyuRankItem(Context context) {
        super(context);
        mContext = context;
        init(context, null);
    }

    public RongyuRankItem(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        init(context, attrs);
    }

    public RongyuRankItem(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private void init(Context context, AttributeSet attributeSet) {
        LayoutInflater.from(context).inflate(R.layout.item_rongyu_rank, this);
        if (attributeSet != null) {

        }
        image = (CircleImageView) findViewById(R.id.image);
        score = (TextView) findViewById(R.id.score);
        rank = (PenjinAvatar) findViewById(R.id.rank);
        name = (TextView) findViewById(R.id.name);
    }

    public void setImage(String url) {
        BitmapUtils.loadUrlImage(url, image, mContext, true, R.drawable.pj_avartar_light_blue);
    }

    public void setRank(String rank) {
        this.rank.setAvatarName(rank);
    }

    public void setScore(String score) {
        this.score.setText(score);
    }

    public void setName(String name) {
        this.name.setText(name);
    }
}
